/*
 * @Author: mylesshie@gmail.com
 * @Date: 2020-07-02 22:26:16
 * @LastEditors: mylesshie@gmail.com
 * @LastEditTime: 2020-07-03 10:02:33
 * @description: 
 */ 
import {
  GET_ACTIVITYS,
  GET_LIVE_LIST
} from '@/constants/activity'

const INIT_STATE = {
  list: [],
  listPageEnd: false,
  liveList: [],
  liveListPageEnd: false
}

export default function activity(state = INIT_STATE, action) {
  switch (action.type) {
    case GET_ACTIVITYS:
      return {
        ...state,
        list: action.data.list,
        listPageEnd: action.data.total <= action.data.pageNum * action.data.pageSize
      }
    case GET_LIVE_LIST:
      return {
        ...state,
        liveList: action.data.list,
        liveListPageEnd: action.data.total <= action.data.pageNum * action.data.pageSize
      }
    default:
      return state
  }
}